'use strict';

App.controller('publishMakeBillController', ['$rootScope', '$scope', '$state', 'Page', function($rootScope, $scope, $state, Page) {/*
	
	$scope.publishMakeBillQuery = {};
	$scope.customerId =	$rootScope.user.sourceId;// 根据登录用户获得客户id
	if($scope.customerId == '' || $scope.customerId == null){
		$state.go('login', null);
		return;
	}
	
	//点击编辑，进入add页面
    $scope.publishBill = $state.params.model;
    if($scope.publishBill == undefined) {
    	  $scope.publishBillId = null;// 添加
    } else {
    	$scope.publishBillId =  $scope.publishBill.billId;
    }
	
	$scope.publishMakeBillTable = {
			query : function() {
				var param = {};
				param.customerId = $scope.customerId;
				param.billNo = $scope.publishMakeBillQuery.billNo;
				param.billId = $scope.publishBillId;
				param.pageIndex = 0;
				param.pageSize = 10;
				Page.ajaxPost('www/publishBill/queryMakeBill.do', param, function (resp) {
					 $scope.dataArray = resp.data.dataArray;
					 
					// 调用分页
				    	$scope.totalPages = resp.data.totalPages;
						laypage({
							cont : 'page_bar',
							pages : $scope.totalPages,// 得到总页数
							skin : '#12bdce',
							skip : true, // 是否开启跳页
							prev : '<', // 若不显示，设置false即可
							next : '>', // 若不显示，设置false即可
							groups : 5, //连续分页数
							curr: 1, //初始化当前页
							jump : function(obj,first) {// 触发分页后的回调
								obj是一个object类型。包括了分页的所有配置信息。
								 first一个Boolean类，检测页面是否初始加载。非常有用，可避免无限刷新。
								if(!first){
									param.pageIndex = obj.curr - 1;
									Page.ajaxPost('www/publishBill/queryMakeBill.do', param, function(resp) {
										$scope.dataArray = resp.data.dataArray;
										$scope.totalPages = resp.data.totalPages;
									});
								}
							}
						})
				 });
			},
			viewDetail : function(data) {// 查看自作单明细
				  $state.go('publishMakeBillDetail', {model: data});
		        },
	}
	$scope.publishMakeBillTable.query();
	
	
	
	
*/}]);